package com.aopeng.mapper;

import com.aopeng.entity.AopengSchool;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface AopengSchoolMapper extends BaseMapper<AopengSchool> {

    //查询南方院校总数
    @Select("select count(school_name) from aopeng_school where school_type = 1")
    int findSouthSchoolById();

    //查询北方院校总数
    @Select("select count(school_name) from aopeng_school where school_type = 2")
    int findNorthSchoolById();

    //查询南方考卷试卷总数
    @Select("select count(b.examination_name) from aopeng_school a,aopeng_examination b where a.id = b.school_id and a.school_type = 1")
    int findSouthSchoolTestPaper();

    //查询北方考卷试卷总数
    @Select("select count(b.examination_name) from aopeng_school a,aopeng_examination b where a.id = b.school_id and a.school_type = 2")
    int findNorthSchoolTestPaper();

    //查询学校点击量
    @Select("select id,school_name,school_type,test_paper_number,click_number from aopeng_school order by click_number desc limit 5")
    List<AopengSchool> findClickNumber5();
}
